using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Threading;
using Integrator.DAL.MESSAGE;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    //Security
    private static SystemLogger log = new SystemLogger();

    public Service () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string HelloWorld()
    {
        string ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
        string ip1 = HttpContext.Current.Request.UserHostAddress;
        if (string.IsNullOrEmpty(ip))
        {
            ip = Context.Request.ServerVariables["REMOTE_ADDR"];
        }
        Thread.Sleep(1000);
        return ip + "  " + ip1;
    }

    [WebMethod(Description = "TRUY VAN SO DU TAI KHOAN")]
    public BalanceEnquiryResponse BalanceEnquiry(BalanceEnquiryRequest request)
    {
        log.LogRequest(request);
        BalanceEnquiryResponse response = (BalanceEnquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HACH TOAN KE TOAN")]
    public FinancialPostingResponse FinancialPosting(FinancialPostingRequest request)
    {
        log.LogRequest(request);
        FinancialPostingResponse response = (FinancialPostingResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "VAN TIN KHACH HANG")]
    public CustomerInquiryResponse CustomerEnquiry(CustomerInquiryRequest request)
    {
        log.LogRequest(request);
        CustomerInquiryResponse response = (CustomerInquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "TRUY VAN DANH SACH TAI KHOAN KHACH HANG")]
    public CustomerRelationInquiryResponse CustomerRelationEnquiry(CustomerRelationInquiryRequest request)
    {
        log.LogRequest(request);
        CustomerRelationInquiryResponse response = (CustomerRelationInquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }
    
    [WebMethod(Description = "GIAI TOA TAI KHOAN, SU DUNG CHO KENH SEC")]
    public EarmarkReleaseResponse EarmarkRelease(EarmarkReleaseRequest request)
    {
        log.LogRequest(request);
        EarmarkReleaseResponse response = (EarmarkReleaseResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "PHONG TOA TAI KHOAN, SU DUNG CHO KENH SEC")]
    public EarmarkResponse Earmark(EarmarkRequest request)
    {
        log.LogRequest(request);
        EarmarkResponse response = (EarmarkResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM GIAI TOA VA CHUYEN KHOAN. SU DUNG CHO KENH SEC")]
    public EarmarkReleaseTransResponse EarmarkReleaseTrans(EarmarkReleaseTransRequest request)
    {
        log.LogRequest(request);
        EarmarkReleaseTransResponse response = (EarmarkReleaseTransResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM CHUYEN KHOAN GIUA 2 TAI KHOAN CASA")]
    public FundTransferResponse FundTransfer(FundTransferRequest request)
    {
        log.LogRequest(request);
        FundTransferResponse response = (FundTransferResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM TRUY VAN TY GIA HOI DOAI")]
    public FxrateEnquiryResponse FxrateEnquiry(FxrateEnquiryRequest request)
    {
        log.LogRequest(request);
        FxrateEnquiryResponse response = (FxrateEnquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM TRUY VAN THONG TIN TAI KHOAN VAY")]
    public LoanEnquiryResponse LoanEnquiry(LoanEnquiryRequest request)
    {
        log.LogRequest(request);
        LoanEnquiryResponse response = (LoanEnquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM LIET KE GIAO DICH TAI KHOAN")]
    public StatementEnquiryResponse StatementEnquiry(StatementEnquiryRequest request)
    {
        log.LogRequest(request);
        StatementEnquiryResponse response = (StatementEnquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM TRUY VAN DIA CHI DIEM GIAO DICH")]
    public BranchEnquiryResponse BranchEnquiry(BranchEnquiryRequest request)
    {
        log.LogRequest(request);
        BranchEnquiryResponse response = (BranchEnquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM HUY GIAO DICH HACH TOAN KE TOAN")]
    public FinancialPostingRevertResponse FinancialPostingRevert(FinancialPostingRevertRequest request)
    {
        log.LogRequest(request);
        FinancialPostingRevertResponse response = (FinancialPostingRevertResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM HUY GIAO DICH CHUYEN KHOAN FUND_TRANSFER")]
    public TxnRevertResponse TxnRevert(TxnRevertRequest request)
    {
        log.LogRequest(request);
        TxnRevertResponse response = (TxnRevertResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM TRUY VAN LAI SUAT TIET KIEM")]
    public TideInterestRateEnquiryResponse TideInterestRateEnquiry(TideInterestRateEnquiryRequest request)
    {
        log.LogRequest(request);
        TideInterestRateEnquiryResponse response = (TideInterestRateEnquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM BOOK MOT STANDING INSTRUCTION")]
    public SIBookingResponse SIBooking(SIBookingRequest request)
    {
        log.LogRequest(request);
        SIBookingResponse response = (SIBookingResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM BOOK MOT SWEEP.CCYCD: 704 - VND")]
    public SWBookingResponse SWBooking(SWBookingRequest request)
    {
        log.LogRequest(request);
        SWBookingResponse response = (SWBookingResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM TRUY VAN THONG TIN STANDING INSTRUCTION")]
    public SoDetailResponse SoDetail(SoDetailRequest request)
    {
        log.LogRequest(request);
        SoDetailResponse response = (SoDetailResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM TRUY VAN CAC STANDING INSTRUCTION CUA MOT CIFNO")]
    public SoSummaryResponse SoSummary(SoSummaryRequest request)
    {
        log.LogRequest(request);
        SoSummaryResponse response = (SoSummaryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM HUY MOT STANDING INSTRUCTION")]
    public SoCancellationResponse SoCancellation(SoCancellationRequest request)
    {
        log.LogRequest(request);
        SoCancellationResponse response = (SoCancellationResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM REVERT GIAO DICH RELEASE AND TRANSFER.SU DUNG CHO KENH SEC")]
    public EarmarkReleaseTransResponse EarnMartTransRevert(EarmarkReleaseTransRequest request)
    {
        log.LogRequest(request);
        EarmarkReleaseTransResponse response = (EarmarkReleaseTransResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "")]
    public FundTransferInterBankResponse FundTransferInterBank(FundTransferInterBankRequest request)
    {
        log.LogRequest(request);
        FundTransferInterBankResponse response = (FundTransferInterBankResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM TRUY VAN THONG TIN LC TU LCREF")]
    public LcInfoEnquiryResponse LcInfoEnquiry(LcInfoEnquiryRequest request)
    {
        log.LogRequest(request);
        LcInfoEnquiryResponse response = (LcInfoEnquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM TRUY VAN THONG TIN BILL TU BILLREF")]
    public BillInfoEnquiryResponse BillInfoEnquiry(BillInfoEnquiryRequest request)
    {
        log.LogRequest(request);
        BillInfoEnquiryResponse response = (BillInfoEnquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM TRUY VAN THONG TIN BILL CUA MOT LCREF")]
    public BillInfoOfLcEnquiryResponse BillInfoOfLcEnquiry(BillInfoOfLcEnquiryRequest request)
    {
        log.LogRequest(request);
        BillInfoOfLcEnquiryResponse response = (BillInfoOfLcEnquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM TRUY VAN THONG TIN CAC BILL CUA MOT CIF")]
    public BillListOfCifEnquiryResponse BillListOfCifEnquiry(BillListOfCifEnquiryRequest request)
    {
        log.LogRequest(request);
        BillListOfCifEnquiryResponse response = (BillListOfCifEnquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM TRUY VAN THONG TIN CAC LC CUA MOT CIF")]
    public LcListOfCifEnquiryResponse LcListOfCifEnquiry(LcListOfCifEnquiryRequest request)
    {
        log.LogRequest(request);
        LcListOfCifEnquiryResponse response = (LcListOfCifEnquiryResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM LIET KE GIAO DICH TAI KHOAN VAY")]
    public LoanStatementResponse LoanStatement(LoanStatementRequest request)
    {
        log.LogRequest(request);
        LoanStatementResponse response = (LoanStatementResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM LIET KE LICH TRA GOC LAI")]
    public LoanRepaymentScheduleResponse LoanRepaymentSchedule(LoanRepaymentScheduleRequest request)
    {
        log.LogRequest(request);
        LoanRepaymentScheduleResponse response = (LoanRepaymentScheduleResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "HAM LIET KE LICH TRA GOC LAI")]
    public LoanDisbursementScheduleResponse LoanDisbursementSchedule(LoanDisbursementScheduleRequest request)
    {
        log.LogRequest(request);
        LoanDisbursementScheduleResponse response = (LoanDisbursementScheduleResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "")]
    public CashWithdrawalResponse CashWithdrawal(CashWithdrawalRequest request)
    {
        log.LogRequest(request);
        CashWithdrawalResponse response = (CashWithdrawalResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

    [WebMethod(Description = "")]
    public MarchantPortalResponse MarchantPortal(MarchantPortalRequest request)
    {
        log.LogRequest(request);
        MarchantPortalResponse response = (MarchantPortalResponse)new BusinessProcess().Process(request);
        log.LogResponse(response);
        return response;
    }

}
